<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="box">
        <ul class="list">
            <li class="item01 li">item1</li>
            <li class="item02 li">item2</li>
            <li class="item03 li">item3</li>
            <li class="item04 li">item4</li>
            <li class="item05 li">item5</li>
            <li class="item06 li">item6</li>
            <li class="item07 li">item7</li>
            <li class="item08 li">item8</li>
            <li class="item09 li">item9</li>
            <li class="item10 li">item10</li>
        </ul>
    </div>

    <script>

        // apply call 改变this 指向
        // var lis = document.querySelectorAll("li")
        // console.log(lis)   // 伪数组  有数组特性 但是没有数组的原型方法  concat slice 

        // // 伪数组 转真数组   展开运算 
        // var list = Array.prototype.slice.call(lis);
        // console.log(list)

        // // []  = new Array()   =  Array.prototype
        // var arr = [].slice.call(lis);
        // console.log(arr,Array.isArray(arr))


        // slice 
        // myslice   数组截取 
        // Array.prototype.myslice = function(startIndex=0,endIndex=this.length){
        //     var list = [];
        //     for(var i=startIndex;i<endIndex;i++){
        //         list.push(this[i]);
        //     }
        //     return list;
        // }

        // var arr = [1,2,3,4,5,6];
        // var arr1 = arr.slice(1,4)
        // var arr2 = arr.myslice(1,4)
        // console.log(arr1)
        // console.log(arr2)

        // Array.prototype.myslice.call(lis)


        // 判断一个数据是否是一个纯对象数据 

        var arr =  new Array(1,2,3);
        var obj = new Object({a:1,b:2})
        var p = new Promise(function(){})
        function Fn(a,b){
            this.a = a;
            this.b = b
        }
        var f = new Fn(100,200);

        console.log(arr)
        console.log(obj)
        console.log(p)
        console.log(f)


        console.log(arr.toString())    // 数组有自己的toString 方法
        console.log(obj.toString())
        console.log(p.toString())
        console.log(f.toString())

        console.log(Object.prototype.toString.call(arr))     // arr.toString()
        console.log(Object.prototype.toString.call(obj))     // obj.toString()  this 改变指向 obj 
        console.log(Object.prototype.toString.call(p))    
        console.log(Object.prototype.toString.call(f))    


        console.log(Object.prototype.toString.call(obj)==='[object Object]')
    </script>
</body>
</html>